using GLib;
using Osso;

public class TestOsso {

    [NoArrayLength ()]
    public static void app_top_cb(string arguments, pointer data) {
        stdout.printf("%s\n", arguments);
        stdout.printf("%x\n", data);
    }

    static int main (string[] args) {
        Osso.Error err;
        Osso.State state;
        string s = "this is the state";
        string filename = "test.file";

        Osso.Rpc rpc;

        state.state_size = (uint32) s.size();
        state.state_data = (pointer) s;

        Osso.Context ctx = new Osso.Context("osso_test_app", "0.0.1", false, null);

        err = ctx.display_state_on();
        if (err != Osso.Error.OK)
            stdout.printf("Error\n");

        err = ctx.state_write(ref state);
        err = ctx.state_read(ref state);

        err = ctx.cp_plugin_execute(filename, state.state_data, true);


        err = ctx.display_blanking_pause();

        pointer p1 = ctx.get_dbus_connection();
        pointer p2 = ctx.get_sys_dbus_connection();

        ctx.application_set_top_cb(app_top_cb, null);

        return 0;
    }
}
